<#import '/ftlLibrary/properteisVariable.ftl' as pv/>
<link href="assets/css/bootstrap-select.css" rel="stylesheet"/>
<script src="assets/js/select2/select2.js"></script>
<style>
    .bootbox-close-button {
        width: 19px;
        height: 19px;
        border: none;
        cursor: pointer;
        -webkit-appearance: none;
        float: right;
        top: 4px;
        left: -5px;
        position: relative;
        background: #E9F5FF url("assets/img/nav-img/icon_close.png") no-repeat 0 0;
    }

    .bootbox .modal-dialog {
        width: 50% !important;
    }

    .modal-content {
        width: 100%;
    }

    input, select, .form-control {
        height: 30px;
    }

    .myDialogDetail label {
        margin-bottom: 0px !important;
    }
    th,td{
        height: 34.29px!important;
    }

    .detailDialogStyle {
        line-height: 30px;
        margin-bottom: 15px;
    }
    .myDialogDetail1 .modal-body{
        padding-bottom: 0px!important;
        border-bottom-right-radius: 5px!important;
        border-bottom-left-radius: 5px!important;
    }
</style>
<div class="row">
    <!-- 映射列表 -->
    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
        <div class="row" style="margin-bottom: 15px;margin-top:15px;font-size: 14px">
                    <span style="padding-left: 16px">
                        请选择报班所要消耗的课时包
                    </span>
        </div>
        <div class="widget flat radius-bordered" style="margin-top: 0;box-shadow:0px 0px 10px rgba(122,161,184,0.3);">
            <div class="widget-body no-padding">
                <div class="table-scrollable" style="border: none;" id="tableScrollable1">
                    <!-- 数据表列信息列表 -->
                    <table class="table table-hover dataTable newtable">
                        <input type="hidden" name="memberType" class="memberType" value="${memberType}">

                        <thead>
                        <tr>
                            <th title="课时包名称">课时包名称</th>
                            <th title="剩余课时数">剩余课时数</th>
                            <th title="剩余有效时期">剩余有效时期</th>
                            <th class="操作">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <#if memberPackagesList?size==0>
                            <tr>
                                <td align="center">无数据</td>
                            </tr>
                        </#if>
                        <#list memberPackagesList as data>
                            <tr>
                                <td>${(data.name???string(data.name?html,"未设置"))!'未设置'}</td>
                                <td>${(data.surplusClassHour???string(data.surplusClassHour?html,"未设置"))!'未设置'}</td>
                                <td>${(data.surplusValidDate???string(data.surplusValidDate?html,"未设置"))!'未设置'}</td>
                                <td align="center">
                                    <a class="showDialogAddSubtractTd1" serializeNum="${serializeNum}"
                                       editUrl="${editUrl}" targetDataId="${data.memberId}" memberPackageId="${data.id}">加减课时</a>
                                </td>
                            </tr>
                        </#list>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(".selectpicker").select2();

    /**
     * 加减课时
     * @param that
     */
    $("#tableScrollable1").on("click",".showDialogAddSubtractTd1",function () {
        var serializeNum = $(this).attr("serializeNum");
        var memberPackageId=$(this).attr("memberPackageId");
        ajaxRequest("tssMemberAddSubtractRecordController/toEditView.do", {
            memberPackageId:memberPackageId,
            serializeNum: serializeNum,
            addSubtractType:1,
            type:1
        }, function (html) {
            getTopWin().bootbox.dialog({
                message: html,
                title: "亲子加减课时",
                className: 'tssMemberSubtractRecordDialog'
            });
            $(".modal-header").find(".bootbox-close-button").removeClass("close");
            $(".modal-header").find(".bootbox-close-button").html("");
        }, function () {
            ajaxError("加载页面失败!")
        }, "get", "html")
    })

</script>